package com.hjy.common;

import io.swagger.annotations.ApiModelProperty;

public class ApiResponse{


    @ApiModelProperty(value = "成功或失败", example = "success", dataType = "string")
    private String status;

    @ApiModelProperty(value = "执行失败原因", example = "用户不存在", dataType = "string")
    private String msg;

    @ApiModelProperty(value = "响应数据集", example = "", dataType = "object")
    private Object data;

    public ApiResponse() {

    }

    public ApiResponse(String status, Object data) {
        this.status = status;
        this.data = data;
    }

    public ApiResponse(String status, String msg) {
        this.status = status;
        this.msg = msg;
    }

    public static ApiResponse success(Object data) {
        return new ApiResponse("success", data);
    }


    public static ApiResponse error(String msg) {
        return new ApiResponse("failed", msg);
    }
}
